package com.snowfield.lbcommon.velocity.haproxy;

import java.util.List;

/**
 * haproxy配置文件listen域
 */
public class ListenSection {
    //名称，格式：proxy{id}
    private String proxyName;
    //绑定信息，格式：v4时，{bindIp}:{bindPort}，v6时，{[bindIp]}:{bindPort}
    private String bind;
    //模式，http/tcp
    private String mode;
    //最大连接，
    private Integer maxconn;

    //健康检测方式
    private String healthCheck;

    //调度方式
    private String balance;

    //是否开启redispatch
    private Boolean optRedispatch = Boolean.FALSE;
    //是否开启forwardfor
    private Boolean optForwardfor = Boolean.FALSE;
    //是否开启keepalive
    private Boolean optKeepalive = Boolean.TRUE;

    //frontend 中的cookie对象
    private List<FECookie> cookieList;
    //是否开启粘贴表
    private Boolean stickTable;

    //ssl offloading
    private Boolean sslOffloading = Boolean.FALSE;
    //前端代理证书路径
    private String proxyCrtPath;
    //是否开启http -> https
    private Boolean redirectHttps = Boolean.FALSE;
    //ssl最低版本：SSLv3 | TLSv1.0 | TLSv1.1 | TLSv1.2 | TLSv1.3
    private String sslMinVer = "TLSv1.2";
    //ssl最高版本：SSLv3 | TLSv1.0 | TLSv1.1 | TLSv1.2 | TLSv1.3
    private String sslMaxVer = "TLSv1.2";

    //frontend 中的Acl对象
    private List<FEAcl> aclList;

    //frontend 中的Header对象
    private List<FEHeader> headerList;

    /**
     * 加速相关，包括压缩、缓存
     */
    private Boolean compression = Boolean.FALSE;
    private Boolean cache = Boolean.FALSE;

    /**
     * 与http basic auth相关的配置
     */
    //是否开启http basic auth
    private Boolean httpauth = Boolean.FALSE;

    //http认证路径，多个间用","分开，单个以"/"开头
    private String httpauthPath;

    //认证用户名
    private String httpauthUsername;

    //认证密码
    private String httpauthPasswd;

    //md5加密后的认证密码
    private String httpauthEnpasswd;

    /**
     * 与安全相关的配置
     */
    //是否开启慢攻击防护
    private Boolean slowAttack = Boolean.FALSE;
    //是否开启ddos攻击防护
    private Boolean ddos = Boolean.FALSE;
    //是否开启antibot攻击防护
    private Boolean antibot = Boolean.FALSE;
    //白名单列表ID，
    private Long whiteListId;
    //黑名单列表ID，
    private Long blackListId;

    //backend server组
    private List<BEServer> serverList;

    public String getProxyName() {
        return proxyName;
    }

    public void setProxyName(String proxyName) {
        this.proxyName = proxyName;
    }

    public String getBind() {
        return bind;
    }

    public void setBind(String bind) {
        this.bind = bind;
    }

    public String getBalance() {
        return balance;
    }

    public void setBalance(String balance) {
        this.balance = balance;
    }

    public String getMode() {
        return mode;
    }

    public void setMode(String mode) {
        this.mode = mode;
    }

    public Integer getMaxconn() {
        return maxconn;
    }

    public void setMaxconn(Integer maxconn) {
        this.maxconn = maxconn;
    }

    public String getHealthCheck() {
        return healthCheck;
    }

    public void setHealthCheck(String healthCheck) {
        this.healthCheck = healthCheck;
    }

    public Boolean getRedirectHttps() {
        return redirectHttps;
    }

    public void setRedirectHttps(Boolean redirectHttps) {
        this.redirectHttps = redirectHttps;
    }

    public String getSslMinVer() {
        return sslMinVer;
    }

    public void setSslMinVer(String sslMinVer) {
        this.sslMinVer = sslMinVer;
    }

    public String getSslMaxVer() {
        return sslMaxVer;
    }

    public void setSslMaxVer(String sslMaxVer) {
        this.sslMaxVer = sslMaxVer;
    }

    public Boolean getOptRedispatch() {
        return optRedispatch;
    }

    public void setOptRedispatch(Boolean optRedispatch) {
        this.optRedispatch = optRedispatch;
    }

    public Boolean getOptForwardfor() {
        return optForwardfor;
    }

    public void setOptForwardfor(Boolean optForwardfor) {
        this.optForwardfor = optForwardfor;
    }

    public Boolean getOptKeepalive() {
        return optKeepalive;
    }

    public void setOptKeepalive(Boolean optKeepalive) {
        this.optKeepalive = optKeepalive;
    }

    public Boolean getCompression() {
        return compression;
    }

    public void setCompression(Boolean compression) {
        this.compression = compression;
    }

    public Boolean getCache() {
        return cache;
    }

    public void setCache(Boolean cache) {
        this.cache = cache;
    }

    public Boolean getHttpauth() {
        return httpauth;
    }

    public void setHttpauth(Boolean httpauth) {
        this.httpauth = httpauth;
    }

    public String getHttpauthPath() {
        return httpauthPath;
    }

    public void setHttpauthPath(String httpauthPath) {
        this.httpauthPath = httpauthPath;
    }

    public String getHttpauthUsername() {
        return httpauthUsername;
    }

    public void setHttpauthUsername(String httpauthUsername) {
        this.httpauthUsername = httpauthUsername;
    }

    public String getHttpauthPasswd() {
        return httpauthPasswd;
    }

    public void setHttpauthPasswd(String httpauthPasswd) {
        this.httpauthPasswd = httpauthPasswd;
    }

    public String getHttpauthEnpasswd() {
        return httpauthEnpasswd;
    }

    public void setHttpauthEnpasswd(String httpauthEnpasswd) {
        this.httpauthEnpasswd = httpauthEnpasswd;
    }

    public Boolean getSslOffloading() {
        return sslOffloading;
    }

    public void setSslOffloading(Boolean sslOffloading) {
        this.sslOffloading = sslOffloading;
    }

    public String getProxyCrtPath() {
        return proxyCrtPath;
    }

    public void setProxyCrtPath(String proxyCrtPath) {
        this.proxyCrtPath = proxyCrtPath;
    }

    public List<FECookie> getCookieList() {
        return cookieList;
    }

    public void setCookieList(List<FECookie> cookieList) {
        this.cookieList = cookieList;
    }

    public Boolean getStickTable() {
        return stickTable;
    }

    public void setStickTable(Boolean stickTable) {
        this.stickTable = stickTable;
    }

    public List<FEAcl> getAclList() {
        return aclList;
    }

    public void setAclList(List<FEAcl> aclList) {
        this.aclList = aclList;
    }

    public List<FEHeader> getHeaderList() {
        return headerList;
    }

    public void setHeaderList(List<FEHeader> headerList) {
        this.headerList = headerList;
    }

    public Boolean getSlowAttack() {
        return slowAttack;
    }

    public void setSlowAttack(Boolean slowAttack) {
        this.slowAttack = slowAttack;
    }

    public Boolean getDdos() {
        return ddos;
    }

    public void setDdos(Boolean ddos) {
        this.ddos = ddos;
    }

    public Boolean getAntibot() {
        return antibot;
    }

    public void setAntibot(Boolean antibot) {
        this.antibot = antibot;
    }

    public Long getWhiteListId() {
        return whiteListId;
    }

    public void setWhiteListId(Long whiteListId) {
        this.whiteListId = whiteListId;
    }

    public Long getBlackListId() {
        return blackListId;
    }

    public void setBlackListId(Long blackListId) {
        this.blackListId = blackListId;
    }

    public List<BEServer> getServerList() {
        return serverList;
    }

    public void setServerList(List<BEServer> serverList) {
        this.serverList = serverList;
    }
}
